
_spiDelay:

;spi.c,46 :: 		void spiDelay() {
;spi.c,47 :: 		asm nop
	NOP
;spi.c,48 :: 		asm nop
	NOP
;spi.c,49 :: 		asm nop
	NOP
;spi.c,50 :: 		asm nop
	NOP
;spi.c,51 :: 		}
	RETURN
; end of _spiDelay

_spiXfer:

;spi.c,61 :: 		int spiXfer(int spiDirection, char *pSpiData)
;spi.c,67 :: 		PORT_CS = 1;
	BSF        RC2_bit+0, 2
;spi.c,70 :: 		PORT_SDI = 1;
	BSF        RC5_bit+0, 5
;spi.c,72 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,73 :: 		PORT_SCLK = 1;
	BSF        RC3_bit+0, 3
;spi.c,74 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,75 :: 		PORT_SCLK = 0;
	BCF        RC3_bit+0, 3
;spi.c,78 :: 		PORT_SDI = spiDirection;
	BTFSC      FARG_spiXfer_spiDirection+0, 0
	GOTO       L__spiXfer14
	BCF        RC5_bit+0, 5
	GOTO       L__spiXfer15
L__spiXfer14:
	BSF        RC5_bit+0, 5
L__spiXfer15:
;spi.c,80 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,81 :: 		PORT_SCLK = 1;
	BSF        RC3_bit+0, 3
;spi.c,82 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,83 :: 		PORT_SCLK = 0;
	BCF        RC3_bit+0, 3
;spi.c,86 :: 		PORT_SDI = 0;
	BCF        RC5_bit+0, 5
;spi.c,88 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,89 :: 		PORT_SCLK = 1;
	BSF        RC3_bit+0, 3
;spi.c,90 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,91 :: 		PORT_SCLK = 0;
	BCF        RC3_bit+0, 3
;spi.c,94 :: 		bitData = 0x80;
	MOVLW      128
	MOVWF      spiXfer_bitData_L0+0
;spi.c,95 :: 		if (spiDirection)
	MOVF       FARG_spiXfer_spiDirection+0, 0
	IORWF      FARG_spiXfer_spiDirection+1, 0
	BTFSC      STATUS+0, 2
	GOTO       L_spiXfer0
;spi.c,98 :: 		retData = 0;
	CLRF       spiXfer_retData_L0+0
;spi.c,100 :: 		while (bitData)
L_spiXfer1:
	MOVF       spiXfer_bitData_L0+0, 0
	BTFSC      STATUS+0, 2
	GOTO       L_spiXfer2
;spi.c,102 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,104 :: 		if (PORT_SDO) retData |= bitData;
	BTFSS      RC4_bit+0, 4
	GOTO       L_spiXfer3
	MOVF       spiXfer_bitData_L0+0, 0
	IORWF      spiXfer_retData_L0+0, 1
	GOTO       L_spiXfer4
L_spiXfer3:
;spi.c,105 :: 		else retData |= 0;
L_spiXfer4:
;spi.c,107 :: 		PORT_SCLK = 1;
	BSF        RC3_bit+0, 3
;spi.c,108 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,109 :: 		PORT_SCLK = 0;
	BCF        RC3_bit+0, 3
;spi.c,110 :: 		bitData = bitData >> 1;
	RRF        spiXfer_bitData_L0+0, 1
	BCF        spiXfer_bitData_L0+0, 7
;spi.c,111 :: 		}
	GOTO       L_spiXfer1
L_spiXfer2:
;spi.c,113 :: 		*pSpiData = retData;
	MOVF       FARG_spiXfer_pSpiData+0, 0
	MOVWF      FSR
	MOVF       spiXfer_retData_L0+0, 0
	MOVWF      INDF+0
;spi.c,114 :: 		}
	GOTO       L_spiXfer5
L_spiXfer0:
;spi.c,118 :: 		retData = *pSpiData;
	MOVF       FARG_spiXfer_pSpiData+0, 0
	MOVWF      FSR
	MOVF       INDF+0, 0
	MOVWF      spiXfer_retData_L0+0
;spi.c,120 :: 		while (bitData)
L_spiXfer6:
	MOVF       spiXfer_bitData_L0+0, 0
	BTFSC      STATUS+0, 2
	GOTO       L_spiXfer7
;spi.c,122 :: 		PORT_SDI = ( retData & bitData ) ? 1 : 0;
	MOVF       spiXfer_bitData_L0+0, 0
	ANDWF      spiXfer_retData_L0+0, 0
	MOVWF      R0+0
	BTFSC      STATUS+0, 2
	GOTO       L_spiXfer8
	MOVLW      1
	MOVWF      R0+0
	GOTO       L_spiXfer9
L_spiXfer8:
	CLRF       R0+0
L_spiXfer9:
	BTFSC      R0+0, 0
	GOTO       L__spiXfer16
	BCF        RC5_bit+0, 5
	GOTO       L__spiXfer17
L__spiXfer16:
	BSF        RC5_bit+0, 5
L__spiXfer17:
;spi.c,123 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,124 :: 		PORT_SCLK = 1;
	BSF        RC3_bit+0, 3
;spi.c,125 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,126 :: 		PORT_SCLK = 0;
	BCF        RC3_bit+0, 3
;spi.c,127 :: 		bitData = bitData >> 1;
	RRF        spiXfer_bitData_L0+0, 1
	BCF        spiXfer_bitData_L0+0, 7
;spi.c,128 :: 		}
	GOTO       L_spiXfer6
L_spiXfer7:
;spi.c,129 :: 		}
L_spiXfer5:
;spi.c,132 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,133 :: 		bitData = PORT_SDO;
	MOVLW      0
	BTFSC      RC4_bit+0, 4
	MOVLW      1
	MOVWF      spiXfer_bitData_L0+0
;spi.c,134 :: 		PORT_SCLK = 1;
	BSF        RC3_bit+0, 3
;spi.c,135 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,136 :: 		PORT_SCLK = 0;
	BCF        RC3_bit+0, 3
;spi.c,139 :: 		PORT_CS = 0;
	BCF        RC2_bit+0, 2
;spi.c,142 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,143 :: 		PORT_SCLK = 1;
	BSF        RC3_bit+0, 3
;spi.c,144 :: 		spiDelay();
	CALL       _spiDelay+0
;spi.c,145 :: 		PORT_SCLK = 0;
	BCF        RC3_bit+0, 3
;spi.c,147 :: 		return bitData;
	MOVF       spiXfer_bitData_L0+0, 0
	MOVWF      R0+0
	CLRF       R0+1
;spi.c,148 :: 		}
	RETURN
; end of _spiXfer

_spiInit:

;spi.c,161 :: 		void spiInit()
;spi.c,164 :: 		TRIS_SDO = 1;                        // SDO input
	BSF        TRISC4_bit+0, 4
;spi.c,165 :: 		TRIS_SDI = 0;                                // SDI output
	BCF        TRISC5_bit+0, 5
;spi.c,166 :: 		TRIS_SCLK = 0;                                // SCLK output
	BCF        TRISC3_bit+0, 3
;spi.c,167 :: 		TRIS_CS = 0;                                // CS output
	BCF        TRISC2_bit+0, 2
;spi.c,172 :: 		PORT_SDI = 0;
	BCF        RC5_bit+0, 5
;spi.c,174 :: 		PORT_SCLK = 0;
	BCF        RC3_bit+0, 3
;spi.c,176 :: 		PORT_CS = 0;
	BCF        RC2_bit+0, 2
;spi.c,177 :: 		}
	RETURN
; end of _spiInit

_spiReadWait:

;spi.c,186 :: 		char spiReadWait()
;spi.c,189 :: 		while (spiXfer(DIR_SPIREAD, &spiData));
L_spiReadWait10:
	MOVLW      1
	MOVWF      FARG_spiXfer_spiDirection+0
	MOVLW      0
	MOVWF      FARG_spiXfer_spiDirection+1
	MOVLW      spiReadWait_spiData_L0+0
	MOVWF      FARG_spiXfer_pSpiData+0
	CALL       _spiXfer+0
	MOVF       R0+0, 0
	IORWF      R0+1, 0
	BTFSC      STATUS+0, 2
	GOTO       L_spiReadWait11
	GOTO       L_spiReadWait10
L_spiReadWait11:
;spi.c,190 :: 		return spiData;
	MOVF       spiReadWait_spiData_L0+0, 0
	MOVWF      R0+0
;spi.c,191 :: 		}
	RETURN
; end of _spiReadWait

_spiRead:

;spi.c,201 :: 		int spiRead(char *pSpiData)
;spi.c,203 :: 		return spiXfer(DIR_SPIREAD, pSpiData);
	MOVLW      1
	MOVWF      FARG_spiXfer_spiDirection+0
	MOVLW      0
	MOVWF      FARG_spiXfer_spiDirection+1
	MOVF       FARG_spiRead_pSpiData+0, 0
	MOVWF      FARG_spiXfer_pSpiData+0
	CALL       _spiXfer+0
;spi.c,204 :: 		}
	RETURN
; end of _spiRead

_spiWrite:

;spi.c,213 :: 		void spiWrite(char spiData)
;spi.c,215 :: 		while (spiXfer(DIR_SPIWRITE, &spiData));
L_spiWrite12:
	CLRF       FARG_spiXfer_spiDirection+0
	CLRF       FARG_spiXfer_spiDirection+1
	MOVLW      FARG_spiWrite_spiData+0
	MOVWF      FARG_spiXfer_pSpiData+0
	CALL       _spiXfer+0
	MOVF       R0+0, 0
	IORWF      R0+1, 0
	BTFSC      STATUS+0, 2
	GOTO       L_spiWrite13
	GOTO       L_spiWrite12
L_spiWrite13:
;spi.c,216 :: 		}
	RETURN
; end of _spiWrite

_CmdSend:

;spi.c,227 :: 		void CmdSend(char Cmd, unsigned char Param)
;spi.c,229 :: 		spiWrite(Cmd);
	MOVF       FARG_CmdSend_Cmd+0, 0
	MOVWF      FARG_spiWrite_spiData+0
	CALL       _spiWrite+0
;spi.c,230 :: 		spiWrite(' ');
	MOVLW      32
	MOVWF      FARG_spiWrite_spiData+0
	CALL       _spiWrite+0
;spi.c,231 :: 		spiWrite(Param);
	MOVF       FARG_CmdSend_Param+0, 0
	MOVWF      FARG_spiWrite_spiData+0
	CALL       _spiWrite+0
;spi.c,232 :: 		spiWrite(0x0d);
	MOVLW      13
	MOVWF      FARG_spiWrite_spiData+0
	CALL       _spiWrite+0
;spi.c,233 :: 		}
	RETURN
; end of _CmdSend
